#include "Lexer.h"
#include <stdio.h>
#include "Parser.h"
#include "CodeGen.h"
#include <iostream>
using namespace C100;


int main(int argc, char *argv[]) {
    if (argc != 2) {
        printf("please input: ./c100 code\n");
        return 0;
    }
    const char *source = argv[1];
    Lexer lex(source);
    lex.getNextToken();
    Parser parser(lex);
    CodeGen codeGen;
    auto root = parser.parse();
    root->accept(&codeGen);
    return 0;
}
//void testLex(char* source){
//    Lexer lexer(source);
//    do{
//        lexer.getNextToken();
//        std::cout << lexer.currentToken->content << "(" << lexer.currentToken->location.line<<"," << lexer.currentToken->location.col<<")"<<std::endl;
//    } while (lexer.currentToken->kind != TokenKind::Eof);
//}
//void testParser(char* source){
//
//}
//int main(int argc,char *argv[]){
//    testLex(argv[1]);
//}